package com.yx.front.controller;


import com.yx.front.annotation.AnonymousAccess;
import com.yx.front.config.global.CommonResult;
import com.yx.front.manager.DictManager;
import com.yx.front.model.param.DictMessageParam;
import com.yx.front.model.vo.DictMessageVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 字典表 前端控制器
 * </p>
 *
 * @author YangXiong
 * @since 2023-03-29
 */
@Slf4j
@RestController
@RequestMapping("/dict-message")
public class DictMessageController {
    @Resource
    private DictManager dictManager;

    @PostMapping("/listByType")
    @AnonymousAccess
    @ApiOperation("根据类型获取字典列表")
    public CommonResult<List<DictMessageVo>> listByType(@RequestBody DictMessageParam param) {
        log.info("DictMessageController listByType info DictMessageParam={}", param);
        return dictManager.listByType(param.getType());
    }
}

